local skel = fk.CreateSkill{
  name = "knu_shenchong",
}

Fk:loadTranslationTable{
  ["knu_shenchong"] = "甚宠",
  [":knu_shenchong"] = "你可以将超出体力上限的手牌当【桃】对任意一名角色使用，然后令其横置并获得一张底牌。",

  ["#knu_shenchong"] = "甚宠：你可以将超出体力上限的手牌当【桃】对任意一名角色使用，然后令其横置并获得一张底牌",

  ["$knu_shenchong1"] = "若为汉家中兴，朕又何惜此金银之物？",
  ["$knu_shenchong2"] = "天子近前，岂曰无人？赏！",

}

skel:addEffect("viewas", {
  pattern = "peach",
  prompt = "#knu_shenchong",
  handly_pile = true,
  card_filter = function(self, player, to_select, selected)
    return #selected < (#player:getCardIds("h") - player.maxHp) and table.contains(player:getHandlyIds(), to_select)
  end,
  view_as = function(self, player, cards)
    if #cards ~= (#player:getCardIds("h") - player.maxHp) or #cards < 1 then return end
    local c = Fk:cloneCard("peach")
    c.skillName = skel.name
    c:addSubcards(cards)
    return c
  end,
  enabled_at_response = function (self, player, response)
    return not response
  end,
  after_use = function (self, player, use)
    local room = player.room
    local to = use.tos[1]
    local list = use.card.subcards
    to:setChainState(true)
    local cards = room:askToCards(to, {
      min_num = 1,
      max_num = 1,
      include_equip = false,
      skill_name = skel.name,
      pattern = tostring(Exppattern{ id = list }),
      cancelable = false,
      expand_pile = list,
    })
    if #cards > 0 then
      room:moveCardTo(cards, Player.Hand, to, fk.ReasonJustMove, skel.name)
    end
  end,
})

return skel